import { _decorator, Component, EventKeyboard, Input, input, KeyCode, Node } from 'cc';
import { TimerManager } from 'db://assets/JJYYCore/Timer/TimerManager';
const { ccclass, property } = _decorator;

@ccclass('TimerMain')
export class TimerMain extends Component {
    start() {
        input.on(Input.EventType.KEY_DOWN,this.delayToActive.bind(this));
    }


    private delayToActive(event:EventKeyboard):void
    {
        switch(event.keyCode)
        {
            case KeyCode.KEY_A:
                console.log("Trigger!");
                this.activeCallBackAfterTimeOver()
                break;
        }
    }

    private activeCallBackAfterTimeOver():void
    {
        TimerManager.Instance.SetTimer(this,1,()=>{
            console.log("TimerMain_触发一个1单位时间的计时器!")
        });
    }
}


